//
//  product.m
//  WestAir
//
//  Created by s on 16/9/27.
//  Copyright © 2016年 Henry. All rights reserved.
//

#import "Product.h"

@implementation Product


- (id)copyWithZone:(nullable NSZone *)zone{
    
    Product *instance = [[Product alloc] init];
    if (instance) {
        
        
        instance.FNumber = self.FNumber;
        instance.FCatogeryID = self.FCatogeryID;
        instance.FQty = self.FQty;
        instance.FPrice =self.FPrice ;
        instance.ImageUrl =self.ImageUrl ;
        instance.FName = self.FName;
        instance.FID =self.FID ;
        
        instance.FSaleType =self.FSaleType ;
        instance.FRemark =self.FRemark ;
        
        instance.remark =self.remark ;

        
    }
    return instance;
}

-(void)setProduct:(NSDictionary  *)dicData  type:(NSString *)type{

    
    self.FCatogeryID=[dicData[@"FCatogeryID"]  integerValue];
    self.FID=[STRING_FORMAT(dicData[@"FID"]) integerValue];
    self.FNumber=[dicData[@"FNumber"]  nullClass];
    
    self.FName=[dicData[@"FName"]  nullClass];
    self.FQty=0;
    self.FPrice=[[STRING_FORMAT(dicData[@"FPrice"])   nullClass]  floatValue];
    
    self.ImageUrl=[dicData[@"ImageUrl"]  nullClass];
    
    self.FSaleType=type;
  

}

-(NSDictionary *)getSumitShopingRequestDic{
    
    NSMutableDictionary  *dicFProductList=[NSMutableDictionary  new];
    
   
    [dicFProductList setObject:[NSNumber numberWithInteger:self.FID] forKey:@"FID"];
    [dicFProductList setObject:self.FName forKey:@"FName"];
    [dicFProductList setObject:self.FNumber forKey:@"FNumber"];
    [dicFProductList setObject:[NSNumber numberWithFloat:self.FPrice] forKey:@"FPrice"];
    [dicFProductList setObject:[NSNumber numberWithInteger:self.FQty] forKey:@"FQty"];
    [dicFProductList setObject:self.FRemark.length?self.FRemark:@""  forKey:@"FRemark"];

    return dicFProductList;
    

}


-(void)setModleDic:(NSDictionary  *)dicParama{
    
    
     self.FID=[dicParama[@"FID"]  integerValue];
     self.FSaleType=[dicParama[@"FSaleType"]  nullClass];
     self.FName=[dicParama[@"FName"]  nullClass];
     self.FEntryID=[dicParama[@"FEntryID"]  integerValue];
     self.FQty=[dicParama[@"FQty"]  integerValue];
     self.FPrice=[dicParama[@"FPrice"]  floatValue];
     self.FRemark=[dicParama[@"FRemark"]  nullClass];
     self.FNumber=[dicParama[@"FNumber"] nullClass];
     self.ImageUrl=[dicParama[@"ImageUrl"]  nullClass];
     Reamark  *remark=[[Reamark  alloc] init];
     remark.FCustomerAddress=[dicParama[@"FCustomerAddress"]  nullClass];
     remark.FCustomerName=[dicParama[@"FCustomerName"]  nullClass];
     remark.FCustomerSeatNum=[dicParama[@"FCustomerSeatNum"]  nullClass];
     remark.FCustomerTel=[dicParama[@"FCustomerTel"]  nullClass];
     self.remark=remark;
}

-(NSDictionary *)getOrderDic{
    
    
    NSMutableDictionary  *dicFProductList=[NSMutableDictionary  new];
    
    [dicFProductList setObject: self.FSaleType forKey:@"FSaleType"];
    [dicFProductList setObject:[NSNumber numberWithInteger:self.FID] forKey:@"FID"];
    [dicFProductList setObject:self.FName forKey:@"FName"];
    [dicFProductList setObject:[NSNumber numberWithFloat:self.FPrice] forKey:@"FPrice"];
    [dicFProductList setObject:[NSNumber numberWithInteger:self.FQty] forKey:@"FQty"];
    [dicFProductList setObject:[self.FRemark  nullClass]  forKey:@"FRemark"];
    
    [dicFProductList setObject:self.remark.FCustomerAddress?:@""  forKey:@"FCustomerAddress"];
    [dicFProductList setObject:self.remark.FCustomerName?:@"" forKey:@"FCustomerName"];
    [dicFProductList setObject:self.remark.FCustomerTel?:@"" forKey:@"FCustomerTel"];
    [dicFProductList setObject:self.remark.FCustomerSeatNum?:@"" forKey:@"FCustomerSeatNum"];
    
    [dicFProductList setObject:[NSNumber numberWithInteger:self.FEntryID] forKey:@"FEntryID"];
    
    return dicFProductList;

}

@end
